package ch7;

public class Worker extends Thread {
	public Worker(String n) {
		super(n);
	}

	@Override
	public void run() {
		while (true) {
			System.out.println("工人" + super.getName() + "工作了一会");
			try {
				sleep(400);
				System.out.println(getName() + "睡到了自然醒，继续干活");
			} catch (InterruptedException e) {
				// TODO 自动生成的 catch 块
				// e.printStackTrace();
				System.out.println(getName() + "被喊醒，继续干活");
			}
		}
	}

}
